#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include<map>
#include <queue>

using namespace std;

typedef long long  ll;
const int N = 1e5 + 10;
ll a[N];

int main1()
{
    int n;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    sort(a, a + n);
    ll _max = INT_MIN;
    for (int i = 1; i < n; i++)
    {
        _max = max(_max, a[i] - a[i - 1]);
    }

    cout << _max << endl;

    return 0;
}

const int N = 10010, M = 5010;

int n, aim;
int arr[N];
int dp[N][M];

int main2()
{
    cin >> n >> aim;
    for (int i = 1; i <= n; i++)
    {
        cin >> arr[i];
    }
    memset(dp, 0x3f, sizeof(dp));
    dp[0][0] = 0;

    for (int i = 1; i <= n; i++)
    {
        for (int j = arr[i]; j <= aim; j++)
        {
            dp[i][j] = min(dp[i - 1][j], dp[i][j - arr[i]] + 1);
        }
    }

    if (dp[n][aim] >= 0x3f3f3f3f) cout << -1 << endl;
    else cout << dp[n][aim];

    return 0;
}

int main3()
{
    int dp[M];
    cin >> n >> aim;
    for (int i = 1; i <= n; i++)
    {
        cin >> arr[i];
    }
    memset(dp, 0x3f, sizeof(dp));
    dp[0] = 0;

    for (int i = 1; i <= n; i++)
    {
        for (int j = arr[i]; j <= aim; j++)
        {
            dp[j] = min(dp[j], dp[j - arr[i]] + 1);
        }
    }

    if (dp[aim] >= 0x3f3f3f3f) cout << -1 << endl;
    else cout << dp[aim];

    return 0;
}

string str;

ll find(int x)
{
    if (x == 0) return 0;

    int l = 0, r = 0, _hash[26] = {0}, k = 0;
    ll sum = 0;
    while (r < n)
    {
        if (++_hash[str[r] - 'a'] == 1) k++;

        while (k > x)
        {
            if (--_hash[str[l] - 'a'] == 0) k--;
            l++;
        }

        sum += r - l + 1;
        r++;
    }

}

int main() 
{
    int n, l, r;
    cin >> n >> l >> r >> str;
    cout << find(r) - find(l - 1) << endl;
}